package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.MallGoodsLabel;
import com.sc.nft.entity.MallGoodsLabelItem;
import com.sc.nft.entity.dto.MallGoodsLabelPageDTO;
import com.sc.nft.entity.vo.MallGoodsLabelPageVO;
import com.sc.nft.mapper.MallGoodsLabelItemMapper;
import com.sc.nft.mapper.MallGoodsLabelMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

@Slf4j
@Repository
public class MallGoodsLabelItemDao extends ServiceImpl<MallGoodsLabelItemMapper, MallGoodsLabelItem> {

    public boolean removeByLabelId(Long mallLabelId) {
        LambdaUpdateWrapper<MallGoodsLabelItem> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(MallGoodsLabelItem::getMallLabelId,mallLabelId);
        return remove(updateWrapper);
    }

    public int countByLabelId(Long mallLabelId) {
        LambdaQueryWrapper<MallGoodsLabelItem> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(MallGoodsLabelItem::getMallLabelId,mallLabelId);
        return count(queryWrapper);
    }
}
